﻿using System;
using System.Windows.Forms;
using HighDiveEngine.Aggregates;
using HighDiveEngine.Model;
using HighDiveEngine.Resources;

namespace HighDiveAdmin.Engine
{
    public interface IHighDiveAdminEngine
    {
        event DelegateVoidDiveScoreDive EventUpdateJudgeScore;
        event DelegateVoidContest EventUpdateDiveQueue;
        event DelegateVoidJudge EventJudgeConnected;
        event DelegateVoidContest EventContestCompleted;

        bool ConnectionPhase { get; set; }
        Contest Contest { get; }
        PersonList ActiveViewingPersonList { get; set; }

        Diver ActiveViewingDiver { get; set; }
        DiveList ActiveViewingDiveList { get; set; }
        Judge ActiveViewingJudge { get; set; }
        Person ActiveViewingPerson { get; set; }
        Dive ActiveViewingDive { get; set; }

        Contest NewContest();
        void NewPerson(Judge judge);
        void UpdateContestInformation(ContestArgs contestArgs);
        Person LoadPerson(string idnumber);
        void StartContest(bool offlineMode);
        void EndContest();
        Contest LoadContest(int? id);
        void SaveContestData();
        void SaveCompleteContest();
        void ResetContest();
        void AddDive(Dive dive);
        void RemoveDive(Dive dive);
        void UpdateDiveScore(DiveScore score, Dive dive);
        void AddJudge(Judge judge);
        void RemoveJudge(Judge judge);
        void SetNumJudges(int numJudges);
        ContestList LoadContestList(bool onlyUpcoming, bool onlyUnstarted);
        void LoadPersonList();
        Dive GetActveDive();
        Judge GetJudge(int judgeNumber);
        void SendActiveDiveToJudges();
        void SendManualScoreToJudge(Judge judge, Dive dive);
        void updateJudgeList(Judge judge);
        void SetActiveViewingJudge(Judge judge);
        void SetActiveViewingDiver(Diver diver);
        void SetActiveViewingDiveList(DiveList diveList);
        Judge LoadJudge(string id);
        void LoadActiveViewingDive(int? id);
        void SaveActiveViewingDive(Dive dive);
        string GetAdminIp();
        void RemoveDiver(Diver diver);
    }
}
